<template>
  <div class="father">
    <div class="head">
      <div class="search">
        <div class="item">
          <div class="item1">
            <img src="@/assets/tenlogo.jpg" width="100%" height="100%" opacity="0">
          </div>
          <div class="item2">
            <router-link to="/r_search" width="100%" height="100%">
              <el-input
                :placeholder= "placeholders"
                prefix-icon="el-icon-search"
                v-model="input2">
              </el-input>
            </router-link>
          </div>
          <div class="item3">
            <router-link to="/messages">
              <img src="@/assets/信息-01.png" alt="信息" width="100%" height="100%" opacity="0.5">
            </router-link>
          </div>
        </div>
      </div>
      <div class="tabbar">
        <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect" text-color="#000" active-text-color="red" router>
          <el-menu-item index="/real" class="el">华为</el-menu-item>
          <el-menu-item index="/h_walk" class="el">鸿蒙智行</el-menu-item>
          <el-menu-item index="/h_select" class="el">华为智选</el-menu-item>
          <el-menu-item index="/environment" class="el">生态周边</el-menu-item>
        </el-menu>
      </div>
    </div>
    <div class="btn">
      <transition name="fade">
      <div class="banner">
          <img v-for="(item) in imgArr" :key="item.id" :src="item.s" v-show="item.id===currentIndex" alt="暂无图片"  >
         <div class="banner-circle">
              <ul>
                <li @click="changeImg(item.id)" v-for="item in imgArr" :key="item.id" :class="item.id===currentIndex?'active':''">

                </li>
              </ul>
         </div>
      </div>
    </transition>
    <div>
            <div class="row-3">
      <ul>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-1" tag="div">
             <img src="@/assets/r1.png" alt="">
        <p>智能照明</p>
          </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-2" tag="div">
             <img src="@/assets/r2.png" alt="">
        <p>智能安防</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-3" tag="div">
             <img src="@/assets/r3.png" alt="">
        <p>环境电器</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-4" tag="div">
             <img src="@/assets/r5.jpg" alt="">
        <p>个户健康</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-5" tag="div">
             <img src="@/assets/r6.png" alt="">
        <p>运动健康</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-6" tag="div">
             <img src="@/assets/r10.png" alt="">
        <p>舒适空气</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-7" tag="div">
             <img src="@/assets/r4.png" alt="">
        <p>健康饮水</p>
      </router-link>
        </li>
        <li>
          <router-link to="/h_walk/l-tiaozhuan1-8" tag="div">
             <img src="@/assets/r7.png" alt="">
        <p>室内运动</p>
      </router-link>
        </li>
      </ul>
    </div>
    <div class="r4">
    </div>
    <div class="r5">
      <p>人气好物 限时众测</p>
    </div>
        <div class="r6" >
            <div class="con">
              <router-link to="/h_walk/l-tiaozhuan2-1" tag="div">
                <Button>去支持</Button>
              </router-link>
            </div>
        </div>
        <div class="r7" >
          <div class="con">
          <router-link to="/h_walk/l-tiaozhuan2-2" tag="div">
                <Button>去支持</Button>
              </router-link>
              </div>
        </div>
        <div class="r8" >
          <div class="con">
          <router-link to="/h_walk/l-tiaozhuan2-3" tag="div">
                <Button>去支持</Button>
              </router-link>
              </div>
        </div>
        <div class="r9">

        </div>
        <div class="r10">

        </div>
        <div class="r">
    </div>
    </div></div>

  </div>
</template>

<script>

export default {
  // eslint-disable-next-line vue/multi-word-component-names
  name: 'h_select',
  data () {
    return {
      currentIndex:0,
      timer:null,
      imgArr:[
        {id:0,s:require('@/assets/L-lunbo2.png')},
        {id:1,s:require('@/assets/L-lunbo1.png')},
        {id:2,s:require('@/assets/L-lunbo3.png')},
      ],
      activeIndex: '/h_select',
      count: 0,
      placeholders: '微泵液冷手机壳',
      data: ['微泵液冷手机壳', 'FreeBuds Pro 3', '平板', 'mate60', '微泵', '手机', 'gt 4', '充电宝', 'p60', '乐臻版', '微泵液冷手机壳', 'FreeBuds Pro 3', '平板', 'mate60', '微泵', '手机', 'gt 4', '充电宝', 'p60', '乐臻版', '微泵液冷手机壳', 'FreeBuds Pro 3', '平板', 'mate60', '微泵', '手机', 'gt 4', '充电宝', 'p60', '乐臻版']
    }
  },
  methods: {
    handleSelect (key, keyPath) {
      console.log(key)
      console.log(keyPath)
    },
    //图片轮播图
    startInterval(){
      clearInterval(this.timer)
      this.timer=setInterval(() => {
        this.currentIndex++
      if(this.currentIndex>this.imgArr.length-1){
        this.currentIndex=0
      }
      }, 2000);
    },
  },
  changeImg(index){
    this.currentIndex=index
  },
  mounted () {
    this.startInterval()
    setInterval(() => {
      this.count++
      if (this.count > this.data.length - 1) {
        this.count = 0
      }
      this.placeholders = this.data[this.count]
    }, 2000)
  }
}

</script>

<style scoped>

.father{
  width: 450px;
  height: 100%;
  background-color: #fff;
}
.head{
  height: 15%;
  background-color:aqua;
}
.body{
  height: 450%;
  background-color: rgb(122, 64, 83);
}
.search{
  height: 60%;
  width: 100%;
  background-color: #9eb7ce;
}
.tabbar{
  height:40%;
  width: 100%;
}
.el{
  width: 25%;
}
.fade-enter{
  opacity: 0;
  transform: translateX(100%);
}
.fade-leave-to{
  opacity: 0;
  transform: translateX(-100%);
  position: absolute;
}
.fade-enter-active, .fade-leave-active {
  transition: all .5s ease;
}
.item{
  display: flex;
  height: 100%;
  background-color:#fff;
}
.item1{
  width: 30%;
  background: #fff;
}
.item2{
  width: 60%;
  padding-top: 10px;
}
.item3{
  padding: 10px;
  width: 10%;
  margin-top: 5px;
}
.banner{
  position: relative;
  height: 250px;
}
.banner img{
  width:100% ;
  height: 250px;
  margin: 0,30px,0,0;
}
li{
  list-style-type: none;
}
.banner-circle{
 position: absolute;
 transform: translateY(50%);
 top: 80%;
  width: 100%;
  height: 20px;}
  .banner-circle ul{
    height: 100%;text-align: center;}
    .banner-circle ul li{

      display: inline-block;width: 14px;height: 14px;margin: 0 5px;
      border-radius: 7px;background-color: rgba(125,125,125,.8);cursor: pointer;}
  .active{background-color: black !important; }
  .row-3 ul{
    padding: 0;
    overflow: hidden;

  }
  .row-3 li{
    width: 25%;
    float: left;
    text-align: center;
  }
  .row-3 p{
    color: #000;
  }
  .r5 p{
    color: #000;
    font-size: 18px;
    margin: 15px;
  }
  .row-3 img{
    width: 100%;
    height: 80px;
  }
.btn{
  width: 100%;
  height: 580px;
  margin-top: 20px;
  overflow: scroll;
  background-color:ghostwhite;
}
.btn::-webkit-scrollbar {
  display: none;
}
.r4{
  height: 200px;
  background-image: url("@/assets/r4-4.png");
  background-size: 100% 100%;
  position: relative;
}
.r6{
  height: 200px;
  background-image: url("@/assets/r6-2.png");
  background-size: 100% 100%;
  position: relative;
  margin-bottom: 20px;
}
.r7{
  height: 200px;
  background-image: url("@/assets/r6-3.png");
  background-size: 100% 100%;
  position: relative;
  margin-bottom: 20px;
}
.r8{
  height: 200px;
  background-image: url("@/assets/r6-4.png");
  background-size: 100% 100%;
  position: relative;
  margin-bottom: 20px;
}
.r9{
  height: 550px;
  background-image: url("@/assets/l-zhuye-1.png");
  background-size: 100% 100%;
  position: relative;
}
.r10{
  height: 550px;
  background-image: url("@/assets/l-zhuye-2.png");
  background-size: 100% 100%;
  position: relative;
}
.r11{
  height: 550px;
  background-image: url("@/assets/l-zhuye-3.png");
  background-size: 100% 100%;
  position: relative;
}
.con{
  position: absolute;
  top: 77%;
  left: 80%;

}
.con button{
  height: 30px;
  border-radius: 15px;
  background-color: red;
  color: white;
}
</style>
